package com.acme.bankapp.service.bank.builder;

import java.util.Map;

abstract class AbstractBuilder<T> {
	protected void validateNotNull(Object argument)
			throws BuildingFailedException {
		if (argument == null) {
			throw new BuildingFailedException();
		}
	}

	protected Double parseDouble(String argument)
			throws BuildingFailedException {
		try {
			return Double.parseDouble(argument);
		} catch (NumberFormatException ex) {
			throw new BuildingFailedException();
		}
	}

	public abstract T buildFromProperties(Map<String, String> properties)
			throws BuildingFailedException;
}
